<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <login :name="username" :age="age"></login>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<script>
    //定义一个局部组件的生命
    const login={
        template: "<div><h2>欢迎你{{name}} 年龄：{{age}}</h2></div>",
        props:['name','age']

    }

    //定义个一个vue实例对象
    const app =new Vue(
        {
            el:"#app",
            data:{
                username:"罗文江",
                age:20
            },
            methods:{},
            //注册组件
            components:{
                login//注册
            }
        }
    )

</script>
</body>
</html>